<template>
    <div>
        <ul>
            <li v-for="i in auditlist" :key="i">{{i.name}}
                <van-button @click="audit(i.id)">审核</van-button>
            </li>
        </ul>
        <van-dialog v-model:show="show" title="标题" show-cancel-button>
          
            <van-field :label='描述信息' v-model='descipt'/>
                <van-radio-group v-model="is_agree">
                    <van-radio name="2">通过</van-radio>
                    <van-radio name="3">未通过</van-radio>
                </van-radio-group>
            <van-button @click='submit'>提交</van-button> 
        </van-dialog>
    </div>
</template>

<script>
import axios from 'axios'
export default {
    data() {
        return {
            auditlist:[],
            show:false,
            descipt:'',
            is_agree:2,
            id:0,
        }
    },
    methods: {
        getlist(){
            axios.get('http://localhost:8000/showuseraudit').then(res => {
                this.auditlist = res.data.list
            })
        },
        audit(id){
            this.id=id
            this.show=true
            console.log(this.id)
        },
        submit(){
            axios.post('http://localhost:8000/audit',{'id':this.id,'descipt':this.descipt,'is_agree':this.is_agree}).then(res => {
                console.log(res.data)
            })
        },
    },
    created() {
        this.getlist()
    }
}
</script>

<scoped>

</scoped>
